
#include "nx_api.h"

#ifdef __PRODUCT_NETXDUO__

#include "netx_mdns_test.h"

/* Frame (76 bytes) */
static const unsigned char pkt1[76] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x0c, /* ..^..... */
0x29, 0x01, 0xd4, 0x79, 0x08, 0x00, 0x45, 0x00, /* )..y..E. */
0x00, 0x3e, 0x00, 0x00, 0x40, 0x00, 0xff, 0x11, /* .>..@... */
0xd9, 0xa1, 0xc0, 0xa8, 0x00, 0x69, 0xe0, 0x00, /* .....i.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x2a, /* .......* */
0x2c, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* ,....... */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x5f, /* ......._ */
0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */
0x00, 0x0c, 0x00, 0x01                          /* .... */
};

/* Frame (153 bytes) */
static const unsigned char pkt2[153] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x1e, /* ..^..... */
0x8f, 0xb1, 0x7a, 0xd4, 0x08, 0x00, 0x45, 0x00, /* ..z...E. */
0x00, 0x8b, 0x01, 0x2a, 0x00, 0x00, 0xff, 0x11, /* ...*.... */
0x18, 0x90, 0xc0, 0xa8, 0x00, 0x04, 0xe0, 0x00, /* ........ */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x77, /* .......w */
0xe2, 0xa6, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x05, 0x5f, /* ......._ */
0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */
0x00, 0x0c, 0x00, 0x01, 0x00, 0x00, 0x11, 0x94, /* ........ */
0x00, 0x0f, 0x0c, 0x43, 0x61, 0x6e, 0x6f, 0x6e, /* ...Canon */
0x4d, 0x46, 0x34, 0x35, 0x30, 0x30, 0x77, 0xc0, /* MF4500w. */
0x0c, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, /* ..router */
0xc0, 0x17, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, /* ........ */
0x00, 0x78, 0x00, 0x04, 0xc0, 0xa8, 0x00, 0x04, /* .x...... */
0xc0, 0x28, 0x00, 0x21, 0x80, 0x01, 0x00, 0x00, /* .(.!.... */
0x00, 0x78, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, /* .x...... */
0x00, 0x50, 0xc0, 0x37, 0xc0, 0x28, 0x00, 0x10, /* .P.7.(.. */
0x80, 0x01, 0x00, 0x00, 0x11, 0x94, 0x00, 0x01, /* ........ */
0x00                                            /* . */
};

/* Frame (103 bytes) */
static const unsigned char pkt3[103] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x0c, /* ..^..... */
0x29, 0x01, 0xd4, 0x79, 0x08, 0x00, 0x45, 0x00, /* )..y..E. */
0x00, 0x59, 0x00, 0x00, 0x40, 0x00, 0xff, 0x11, /* .Y..@... */
0xd9, 0x86, 0xc0, 0xa8, 0x00, 0x69, 0xe0, 0x00, /* .....i.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x45, /* .......E */
0x48, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* HP...... */
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x5f, /* ......._ */
0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */
0x00, 0x0c, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x0c, /* ........ */
0x00, 0x01, 0x00, 0x00, 0x11, 0x94, 0x00, 0x0f, /* ........ */
0x0c, 0x43, 0x61, 0x6e, 0x6f, 0x6e, 0x4d, 0x46, /* .CanonMF */
0x34, 0x35, 0x30, 0x30, 0x77, 0xc0, 0x0c        /* 4500w.. */
};

/* Frame (103 bytes) */
static const unsigned char pkt4[103] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x0c, /* ..^..... */
0x29, 0x01, 0xd4, 0x79, 0x08, 0x00, 0x45, 0x00, /* )..y..E. */
0x00, 0x59, 0x00, 0x00, 0x40, 0x00, 0xff, 0x11, /* .Y..@... */
0xd9, 0x86, 0xc0, 0xa8, 0x00, 0x69, 0xe0, 0x00, /* .....i.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x45, /* .......E */
0x48, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* HP...... */
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x5f, /* ......._ */
0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, /* p.local. */
0x00, 0x0c, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x0c, /* ........ */
0x00, 0x01, 0x00, 0x00, 0x11, 0x94, 0x00, 0x0f, /* ........ */
0x0c, 0x43, 0x61, 0x6e, 0x6f, 0x6e, 0x4d, 0x46, /* .CanonMF */
0x34, 0x35, 0x30, 0x30, 0x77, 0xc0, 0x0c        /* 4500w.. */
};

MDNS_TEST_SEQ mdns_poof[] = {
    {TITLE, "Passive observation of failures", 31, 0},

    /* Inject a response. */
    {INJECT, (char*)&pkt2[0], sizeof(pkt2), 0},

    /* 4 RRs are received. */
    {MDNS_CHECK_RR_COUNT_REMOTE, NX_NULL, 4, 0},

    /* Inject two queries. */
    {INJECT, (char*)&pkt1[0], sizeof(pkt1), 0},
    {INJECT, (char*)&pkt1[0], sizeof(pkt1), 0},

    /* Wait more than 10 seconds. */
    {WAIT, NX_NULL, 0, 11},

    /* Check whether the RR is deleted. */
    {MDNS_CHECK_RR_COUNT_REMOTE, NX_NULL, 3, 0},
};

int mdns_poof_size = sizeof(mdns_poof) / sizeof(MDNS_TEST_SEQ);

#endif /* __PRODUCT_NETXDUO__  */

